//
//  LeftCollectionCell.m
//  GBKHOME
//
//  Created by XMYY-19 on 2017/9/4.
//
//

#import "LeftCollectionCell.h"
#import "Masonry.h"

@implementation LeftCollectionCell
-(instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self =[super initWithFrame:frame];
        self.picImage =[[UIImageView alloc] init];
        [self.contentView addSubview:self.picImage];
        
        self.nameLabel =[[UILabel alloc] init];
        [self.contentView addSubview:self.nameLabel];
        
        self.borderView = [[UIView alloc]init];
        [self.contentView addSubview:self.borderView];
    }
    return self;
}

-(void)setNameLabel:(UILabel *)nameLabel
{
    _nameLabel = nameLabel;
    nameLabel.font =[UIFont systemFontOfSize:kFONT_SIZE_FROM_PX_VALUE(24)];
    nameLabel.textColor =[UIColor colorWithRGBColorByString:@"#c2e6f9"];
    nameLabel.textAlignment = NSTextAlignmentCenter;
}

-(void)setBorderView:(UIView *)borderView{
    _borderView = borderView;
    [_borderView.layer setBorderColor:[UIColor colorWithRGBColorByString:@"#666666"].CGColor];
    _borderView.layer.borderWidth = .3;
}

-(void)setNameStr:(NSString *)nameStr
{
    _nameStr = nameStr;
    self.nameLabel.text =  [NSString stringWithFormat:@"%@",nameStr];
}

-(void)layoutSubviews
{
    [super layoutSubviews];
    if (IS_IPAD) {
        [_picImage setFrame:(CGRect){(self.contentView.width-60)/2,50,60,60}];
        [_nameLabel setFrame:(CGRect){0,_picImage.bottom+10,self.contentView.width,24}];
    } else {
        [_picImage setFrame:(CGRect){(self.contentView.width-60)/2,10,60,60}];
        [_nameLabel setFrame:(CGRect){0,_picImage.bottom,self.contentView.width,24}];
    }
    
    _nameLabel.textAlignment = NSTextAlignmentCenter;
    [_borderView setFrame:(CGRect){0,0,self.contentView.width,self.contentView.height}];

}

@end
